<%@ page import="org.apache.log4j.Logger" %>
<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="top.sehnsucht.vo.Result" %>
<%@ page import="top.sehnsucht.dao.StudentDao" %>
<%@ page import="top.sehnsucht.dao.impl.StudentDaoImpl" %>
<%@ page import="top.sehnsucht.service.UserService" %>
<%@ page import="top.sehnsucht.service.impl.UserServiceImpl" %>
<%@ page import="top.sehnsucht.service.StudentService" %>
<%@ page import="top.sehnsucht.service.impl.StudentServiceImpl" %>
<%@ page import="top.sehnsucht.dao.ArticleDao" %>
<%@ page import="top.sehnsucht.dao.impl.ArticleDaoImpl" %>
<%@ page import="top.sehnsucht.service.ArticleService" %>
<%@ page import="top.sehnsucht.service.impl.ArticleServiceImpl" %><%--
  Created by IntelliJ IDEA.
  User: windows
  Date: 2021/12/23
  Time: 10:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    Logger logger = Logger.getLogger(this.getClass());

    response.setHeader("Content-Type", "application/json;charset=UTF-8");//注意加上这一句

    logger.debug("现在路径是: " + request.getRequestURL());

    Result result = new Result();
    result.setCode(0);
    result.setCount(1L);

    ArticleDao articleDao = new ArticleDaoImpl();
    ArticleService articleService = new ArticleServiceImpl(articleDao);

    System.out.println(articleService.selectAllArticle());


    String json = JSON.toJSONString(articleService.selectAllArticle());

    System.out.println(json);

    out.println("{\"code\":" + result.getCode() + ",\"msg\":\"\",\"count\":" + 21 + ",\"data\":" + json + "}");
%>

